dict_1 = {"name":'小明', 'age':18, 'address':'广西南宁广西建设职业技术学院', "name":'小花'}
print(dict_1)
dict_2 = dict(name='小花', age=20, address='广西南宁广西建设职业技术学院')

print(dict_1["name"])
print(dict_2["age"])

color_dict = {'purple': '紫色', 'green': '绿色', 'black': '黑色'}
print(color_dict['purple'])
print(color_dict['green'])
print(color_dict['black'])

for item in color_dict.items():
    print(itme)
    print(itme[1])

# print(color_dict['red'])
# if 'red' in color_dict:
#      print(color_dict['red'])
# else:
#     print('键不存在')

add_dict = {'stu1': '小明'}
add_dict.update(stu2='小刚')
add_dict['stu3'] = '小兰'
print(add_dict)

modify_dict = {'stu1': '小明', 'stu2': '小刚', 'stu3': '小兰'}
modify_dict.update(stu2='小强')
modify_dict['stu3'] = '小婷'
print(modify_dict)

per_info = {'001': '张三', '002': '李四', '003': '王五', '004': '赵六'}
print(per_info.pop('001'))
print(per_info)

per_info = {'001': '张三', '002': '李四', '003': '王五', '004': '赵六'}
print(per_info.popitem())
print(per_info)

per_info = {'001': '张三', '002': '李四', '003': '王五', '004': '赵六'}
per_info.clear()
print(per_info)

per_info = {'001': '张三', '002': '李四', '003': '王五'}

print(per_info.items())
per_info = {'001': '张三', '002': '李四', '003': '王五'}
for i in per_info.items():
    print(i)

print(per_info.keys())

for i in per_info.keys():
        print(i)

print(per_info.values())

per_info = {'001': '张三', '002': '李四', '003': '王五'}
for i in per_info.values():
    print(i)


set_one = {'Python'}
set_two = {0.3, 1, 'Python'}
set_three = {0.3, 1, 1, 'Python'}
print(set_one)
print(set_two)
print(set_three)

set_one = set([1, 1, 2, 3])
set_two = set((2, 3, 4))
set_three = set('Hello')
set_four = set()
print(set_one)
print(set_two)
print(set_three)
print(set_four)

demo_set = set()
demo_set.add('py')
demo_set.update('thon')
demo_set.add('py')
print(demo_set)

# remove_set = {'red', 'green', 'black'}
# remove_set.remove('red')
# print(remove_set)
# remove_set.remove('blue')
# print(remove_set)

discard_set = {'python','php','java'}
discard_set.discard('java')
discard_set.discard('ios')
print(discard_set)

pop_set = {'green', 'blue', 'white'}
pop_set.pop()
print(pop_set)

clear_set = {'red', 'green', 'black'}
clear_set.clear()
print(clear_set)

set_a = {'a', 'c'}
set_b = {'b', 'c'}
print(set_a | set_b)

print(set_a & set_b)

print(set_a - set_b)
print(set_b - set_a)

print(set_a ^ set_b)



















